首页>代码>Spring实现OAUTH2.0代码DEMO>/OAuth2.0 JAVA服务端和客户端功能实现(带jar包)/sparklr/src/org/springframework/security/oauth/examples/sparklr/mvc/PhotoServiceUserController.java
package org.springframework.security.oauth.examples.sparklr.mvc; import java.security.Principal; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.oauth.examples.sparklr.PhotoServiceUser; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; /** * @author Michael Lavelle * * Added to provide an endpoint from which Spring Social can obtain authentication details */ @RequestMapping("/me") @Controller public class PhotoServiceUserController { private UserDetailsService userDetailsService; @ResponseBody @RequestMapping("") public PhotoServiceUser getPhotoServiceUser(Principal principal) { UserDetails userDetails = userDetailsService.loadUserByUsername(principal.getName()); return new PhotoServiceUser(userDetails.getUsername(),userDetails.getUsername()); } public void setUserDetailsService(UserDetailsService userDetailsService) { this.userDetailsService = userDetailsService; } }
最近下载更多
wubz2008 LV5
2022年3月17日
liu83428190 LV6
2022年3月2日
天险无涯 LV15
2021年10月14日
huangwq LV1
2021年9月23日
asdsasddas LV6
2021年1月15日
dongyan1 LV1
2021年1月11日
郭亚钢 LV8
2020年10月8日
qinyt_baosight LV1
2020年6月19日
binghfengkaier LV1
2020年5月19日
lyd19931203 LV21
2020年3月26日
最近浏览更多
heartrain LV3
2023年8月31日
zgxqna
2023年6月1日
暂无贡献等级
CrystalQ LV8
2022年12月16日
hapsea
2022年7月25日
暂无贡献等级
幸存者hhhhh
2022年7月7日
暂无贡献等级
liu83428190 LV6
2022年3月2日
huangwq LV1
2021年9月23日
xx1371590378 LV1
2021年6月7日
也会心痛 LV1
2021年3月31日
asdsasddas LV6
2021年1月15日